<template>
    <div class="content">
        <navigator 
            :title="'我的任务'" 
            :title_back="'rgb(255,170,81)'">
        </navigator>
        <div class="count">
            <div class="head">
                <div class="number">
                    <div>
                        <div class="num">
                            {{ result.nowCount }}
                        </div>
                        <div class="title">
                            本轮获得极豆
                        </div>
                    </div>
                    <div>
                        <div class="num">
                            {{ result.allCount }}
                        </div>
                        <div class="title">
                            累计赚取(个)
                        </div>
                    </div>
                </div>
                <div class="task">
                    极豆任务每周一0点更新,未完成的任务也将同步更新
                </div>
            </div>
        </div>
        <div class="taskList">
            <div class="taskTitle">
                日常任务
            </div>
            <div class="taskItem">
                <div class="item" v-for="item in result.result" :key="item.ID">
                    <div class="img">
                        <img :src="item.task_icon" alt="">
                    </div>
                    <div class="detail">
                        <div class="detailTitle">
                            {{ item.task_title }}
                        </div>
                        <div class="detailDesc">
                            {{ item.task_desc }}
                        </div>
                    </div>
                    <div class="icon">
                        <span>
                            + {{ item.task_num }}
                        </span>
                        <img src="../../static/user/gold.png" alt="">
                    </div>
                    <div class="operate">
                        去完成
                    </div>
                </div>
            </div>
        </div>
        <!-- <div class="taskNone" v-if="result.length == 0">
            任务全做完了，真棒~
        </div> -->
    </div>
</template>
<script>
    import navigator from '@/components/nav-head'
    import {
        getPolar
    } from '@/api'
    export default {
        components: {
            navigator
        },
        created(){
            this.getList()
        },
        data() {
            return {
                result:{
                    allCount: 0,
                    nowCount: 0,
                    result: []
                }
            }
        },
        methods: {
            getList(){
                getPolar().then(res => {
                    if(res.data.code == 1){
                        this.result = res.data.result;
                    }
                })
            }
        }
    }
</script>
<style lang="scss" scoped>
    .content{
        padding-top: 44px;
        .count{
            width: 100%;
            height: 180px;
            background-image: linear-gradient(to bottom,rgb(255,170,81),rgb(252,77,97));
            .head{
                height: 120px;
                padding: 25px 0;
                .number{
                    display: flex;
                    >div{
                        width: 50%;
                        text-align: center;   
                        color: #fff;
                        .num{
                            height: 50px;
                            line-height: 50px;
                            font-size: 32px;
                        }
                        .title{
                            color: #eee;
                        }
                    }
                }
            }
            .task{
                height: 40px;
                line-height: 40px;
                position: relative;
                top: 41px;
                background-color: rgba(255,255,255,0.1);
                text-align: center;
                color: #fff;
                letter-spacing: 1px;
                font-size: 13px;
            }
        }
        .taskList{
            padding: 0 4%;
            padding-top: 20px;
            .taskTitle{
                height: 30px;
                line-height: 30px;
                font-size: 17px;
                font-weight: bold;
            }
            .taskItem{
                .item{
                    height: 101px;
                    padding: 15px 0;
                    display: flex;
                    border-bottom: 1px solid #eee;
                    .img{
                        width: 12%;
                        height: 70px;
                        display: flex;
                        align-items: center;
                        img{
                            width: 70%;
                        }
                    }
                    .detail{
                        width: 40%;
                        .detailTitle{
                            width: 100%;
                            height: 25px;
                            line-height: 25px;
                            font-weight: bold;
                            font-size: 16px;
                        }
                        .detailDesc{
                            height: 45px;
                            line-height: 20px;
                            padding: 2.5px 0;
                            font-size: 13px;
                            color: rgb(121, 120, 120);
                            overflow: hidden;
                        }

                    }
                    .icon{
                        width: 25%;
                        display: flex;
                        justify-content: flex-end;
                        align-items: center;
                        img{
                            height: 20px;
                        }
                        span{
                            font-weight: bold;
                            color: #00a6ff;
                        }
                    }
                    .operate{
                        width: 20%;
                        height: 30px;
                        line-height: 29px;
                        border: 1px solid #ff6300;
                        text-align: center;
                        margin: calc(3% - 2px);
                        margin-top: 20px;
                        border-radius: 15px;
                        color: #ff6300;
                        font-size: 13px;
                        font-weight: bold;
                    }
                }
            }
        }
        .taskNone{
            line-height: 250px;
            color: #999;
            text-align: center;
        }
    }
</style>